home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.5)
-
- import logging
- import digsbysite
- import common.asynchttp as asynchttp
- import re
- import util
- log = logging.getLogger('hotmail.ajax')
-
- def FlagsCreate(*args):
- return util.Storage(zip(args[::2], args[1::2]))
-
- XMLPost = 0
- null = None
-
- class FppParamType(object):
- String = ('_string',)
- Date = ('_date',)
- Array = ('_array',)
- oArray = ('_oArray',)
- Primitive = ('_primitive',)
- Object = ('_object',)
- Enum = ('_enum',)
- Custom = '_custom'
-
-
- class TypeSystem(object):
- _isFppObject = True
-
- def __init__(self, name_or_type, name = None, val = None):
- if name is not None:
- type = name_or_type
- name = name
- else:
- type = FppParamType.Custom
- name = name_or_type
- self.name = name
- self.type = type
- self.value = val
-
-
- def escape(instance):
- f = {
- '_string': FppProxy.escape,
- '_date': (lambda a: a),
- '_array': FppProxy.arrayToString,
- '_oArray': FppProxy.objToStringImpl,
- '_object': FppProxy.objToStringImpl,
- '_primitive': (lambda a: str(a).lower()),
- '_enum': (lambda a: str(a)) }.get(util.get(instance, 'type', None), FppProxy.objToString)
- escaped_val = f(util.get(instance, 'value', None))
- if escaped_val is None:
- return 'null'
-
- return escaped_val
-
- escape = staticmethod(escape)
-
- def __str__(self):
- return '<TypeSystem %r>' % self.name
-
-
- def toString(self):
- return TypeSystem.escape(self)
-
-
- def default(cls):
- x = cls('')
- x.value = type(cls._default)(cls._default)
- return x
-
- default = classmethod(default)
-
-
- class _string(TypeSystem):
- _default = ''
-
- def __init__(self, name):
- TypeSystem.__init__(self, '_string', name)
-
-
-
- class _array(TypeSystem):
- _default = []
-
- def __init__(self, name):
- TypeSystem.__init__(self, '_array', name)
-
-
-
- class _enum(TypeSystem):
- _default = 0
-
- def __init__(self, name):
- TypeSystem.__init__(self, '_enum', name)
-
-
-
- class _primitive(TypeSystem):
- _default = False
-
- def __init__(self, name):
- TypeSystem.__init__(self, '_primitive', name)
-
-
-
- class _oArray(TypeSystem):
- _default = { }
-
- def __init__(self, name):
- TypeSystem.__init__(self, '_oArray', name)
-
-
-
- class _object(TypeSystem):
- _default = { }
-
- def __init__(self, name):
- TypeSystem.__init__(self, '_object', name)
-
-
- _custom = TypeSystem
-
- class FppMetaclass(type):
- _classes = {
- '_enum': _enum,
- '_string': _string,
- '_array': _array,
- '_primitive': _primitive,
- '_object': _object,
- '_oArray': _oArray }
-
- def __init__(cls, name, bases, dict):
- for _name, typ in cls._fields_:
-
- def getter(self, _name = _name, typ = (typ,)):
- if not hasattr(self, '_field_%s' % name):
- setattr(self, '_field_%s' % name, FppMetaclass._classes[typ].default())
-
- val = getattr(self, '_field_%s' % _name)
- if getattr(val, 'type', None) != typ:
- if val is None or val._isFppObject:
- return val
-
- raise ValueError('%r has an invalid %r (with type = %r, value = %r)', self, _name, val.type, val.value)
-
- return val
-
-
- def setter(self, val, _name = _name, typ = typ):
- if val is not None and hasattr(val, 'type'):
- if val.type != typ:
- raise TypeError('%r must have type %r for the %r field. Got %r (value = %r) instead.', self, typ, _name, val.type, val.value)
-
- elif val is None or getattr(val, '_isFppObject', False):
- pass
- else:
- x = FppMetaclass._classes[typ].default()
- x.value = val
- val = x
- setattr(self, '_field_%s' % _name, val)
-
- setattr(cls, _name, property(getter, setter))
- del getter
- del setter
-
-
- def default(_cls):
- i = cls()
- for _name, typ in i._fields_:
- setattr(i, _name, FppMetaclass._classes[typ].default())
-
- return i
-
- default = (classmethod,)(default)
- dict['default'] = default
- FppMetaclass._classes[name] = cls
- cls.default = default
- cls._isFppObject = True
- type.__init__(cls, name, bases, dict)
-
-
-
- class FppClass(object):
- _fields_ = []
- __metaclass__ = FppMetaclass
-
- def __init__(self, *args, **kwds):
- fieldnames = (lambda .0: for x in .0:
- x[0])(self._fields_)
- for i in range(len(args)):
- setattr(self, self._fields_[i][0], args[i])
-
- for key in kwds:
- setattr(self, key, kwds[key])
-
-
-
- def __str__(self):
- res = [
- '{']
- for name, typ in self._fields_:
- cls = FppMetaclass._classes[typ]
- val = getattr(self, name)
- if val is None:
- res.append('null')
- else:
- res.append(cls.escape(val))
- res.append(',')
-
- if res[-1] == ',':
- res.pop(-1)
-
- res.append('}')
- return ''.join(res)
-
- toString = escape = __str__
-
- def __repr__(self):
- return '<%s %s>' % (type(self).__name__, (' '.join,)((lambda .0: for entry in .0:
- '%s=%r' % (entry[0], getattr(self, entry[0], None)))(self._fields_)))
-
-
-
- class FppError(FppClass):
- _fields_ = [
- ('ErrorCode', '_string'),
- ('Message', '_string'),
- ('ErrorObj', '_object'),
- ('StackTrace', '_string')]
-
-
- class FppReturnPackage(FppClass):
- _fields_ = [
- ('Status', '_enum'),
- ('Value', '_object'),
- ('OutRefParams', '_oArray'),
- ('Error', 'FppError'),
- ('ProfilingInfo', '_object')]
-
-
- class InboxUiData(FppClass):
- _fields_ = [
- ('FolderListHtml', '_string'),
- ('MessageListHtml', '_string'),
- ('MessageHtml', '_string'),
- ('RedirectUrl', '_string')]
-
-
- class HmCandidacyInfo(FppClass):
- _fields_ = [
- ('Status', '_enum'),
- ('Guid', '_string'),
- ('ShowMakeLiveContact', '_enum')]
-
-
- class HmAuxData(FppClass):
- QueryArgName = 'Aux'
- _fields_ = [
- ('Value', '_string'),
- ('LiveContactCandidacyInfo', 'HmCandidacyInfo')]
-
-
- class MessageRenderingInfo(FppClass):
- _fields_ = [
- ('MessageId', '_string'),
- ('FolderId', '_string'),
- ('OpenMessageBody', '_primitive'),
- ('AllowUnsafeContent', '_primitive'),
- ('OverrideCodepage', '_primitive'),
- ('HmAuxData', 'HmAuxData'),
- ('SortKey', '_enum'),
- ('SortAsc', '_primitive'),
- ('Action', '_enum')]
-
-
- class MessageRenderingInfoNew(MessageRenderingInfo):
- _fields_ = [
- ('MessageId', '_string'),
- ('FolderId', '_string'),
- ('OpenMessageBody', '_primitive'),
- ('AllowUnsafeContent', '_primitive'),
- ('OverrideCodepage', '_primitive'),
- ('UnknownArgument', '_primitive'),
- ('HmAuxData', 'HmAuxData'),
- ('SortKey', '_enum'),
- ('SortAsc', '_primitive'),
- ('Action', '_enum'),
- ('UnknownArgument2', '_primitive')]
-
-
- class MessageListRenderingInfo(FppClass):
- _fields_ = [
- ('FolderId', '_string'),
- ('PageSize', '_primitive'),
- ('PageDirection', '_enum'),
- ('PageSkip', '_primitive'),
- ('SortKey', '_enum'),
- ('SortAsc', '_primitive'),
- ('AnchorMessageId', '_string'),
- ('AnchorMessageDate', '_string'),
- ('PageNumCurrent', '_primitive'),
- ('PageNumMidStart', '_primitive'),
- ('IsSearchResults', '_primitive'),
- ('SearchKeyword', '_string'),
- ('IsRtl', '_primitive'),
- ('MessageCount', '_primitive')]
-
-
- class MessageListRenderingInfoNew(MessageListRenderingInfo):
- _fields_ = [
- ('FolderId', '_string'),
- ('PageDirection', '_enum'),
- ('PageSkip', '_primitive'),
- ('SortKey', '_enum'),
- ('SortAsc', '_primitive'),
- ('AnchorMessageId', '_string'),
- ('AnchorMessageDate', '_string'),
- ('PageNumCurrent', '_primitive'),
- ('PageNumMidStart', '_primitive'),
- ('IsSearchResults', '_primitive'),
- ('SearchKeyword', '_string'),
- ('UnknownArgument1', '_primitive'),
- ('UnknownArgument2', '_primitive'),
- ('UnknownArgument3', '_enum')]
-
-
- class HmSimpleMsg(FppClass):
- _fields_ = [
- ('IsBlocking', '_primitive'),
- ('YesCode', '_primitive'),
- ('NoCode', '_primitive'),
- ('Message', '_string')]
-
-
- class __2(FppClass):
- _fields_ = [
- ('IsBlocking', '_primitive'),
- ('YesCode', '_primitive'),
- ('NoCode', '_primitive'),
- ('Message', '_string')]
-
-
- class __5(FppClass):
- _fields_ = [
- ('ExistingContacts', '_array'),
- ('PotentialContacts', '_array'),
- ('HasExistingContacts', '_primitive'),
- ('HasPotentialContacts', '_primitive')]
-
-
- class __0(FppClass):
- _fields_ = [
- ('Url', '_string'),
- ('CommandCode', '_primitive'),
- ('Text', '_string')]
-
-
- class __1(FppClass):
- _fields_ = [
- ('MessageType', '_enum'),
- ('InfoCode', '_primitive'),
- ('Message', '_string'),
- ('ExtendedMessage', '_string'),
- ('PSValue', '_string')]
-
-
- class __3(FppClass):
- _fields_ = [
- ('FileName', '_string'),
- ('FileId', '_string'),
- ('Success', '_primitive'),
- ('ShowMessage', '_primitive'),
- ('ErrorCode', '_primitive')]
-
-
- class ABContact(FppClass):
- _fields_ = [
- ('DisplayName', '_string'),
- ('PreferredEmail', '_string'),
- ('ContactType', '_enum'),
- ('PassportName', '_string'),
- ('Guid', '_string'),
- ('IsMessengerUser', '_primitive'),
- ('IsFavorite', '_primitive'),
- ('Cid', '_string'),
- ('Emails', '_array'),
- ('GleamState', '_enum')]
-
-
- class ABDetailedContact(FppClass):
- _fields_ = [
- ('ContactType', '_enum'),
- ('FirstName', '_string'),
- ('LastName', '_string'),
- ('PassportName', '_string'),
- ('NickName', '_string'),
- ('Comment', '_string'),
- ('IsMessengerUser', '_primitive'),
- ('IsSmtpContact', '_primitive'),
- ('IsFavorite', '_primitive'),
- ('Emails', '_array'),
- ('Phones', '_array'),
- ('Locations', '_array'),
- ('WebSites', '_array'),
- ('Dates', '_array'),
- ('Guid', '_string'),
- ('Cid', '_string')]
-
-
- class ABGroup(FppClass):
- _fields_ = [
- ('Guid', '_string'),
- ('QuickName', '_string')]
-
-
- class ABDetailedGroup(FppClass):
- _fields_ = [
- ('Guid', '_string'),
- ('QuickName', '_string'),
- ('Count', '_primitive')]
-
-
- class __4(FppClass):
- _fields_ = [
- ('Groups', '_array'),
- ('Contacts', '_array'),
- ('FileAs', '_enum'),
- ('SelectedGuid', '_string'),
- ('SelectedGroup', 'ABDetailedGroup'),
- ('SelectedContact', 'ABDetailedContact'),
- ('HasSelectedGuid', '_primitive'),
- ('HasSelectedGroup', '_primitive')]
-
-
- class ABEmail(FppClass):
- _fields_ = [
- ('Type', '_enum'),
- ('Email', '_string')]
-
-
- class ABPhone(FppClass):
- _fields_ = [
- ('Type', '_enum'),
- ('Phone', '_string')]
-
-
- class ABLocation(FppClass):
- _fields_ = [
- ('Name', '_string'),
- ('Street', '_string'),
- ('City', '_string'),
- ('State', '_string'),
- ('Country', '_string'),
- ('PostalCode', '_string')]
-
-
- class ABDate(FppClass):
- _fields_ = [
- ('Day', '_string'),
- ('Month', '_string')]
-
-
- class ABWebSite(FppClass):
- _fields_ = []
-
-
- class __6(FppClass):
- _fields_ = [
- ('MailboxSize', '_string'),
- ('MailboxQuota', '_string')]
-
-
- class __7(FppClass):
- _fields_ = [
- ('FolderId', '_string'),
- ('Name', '_string'),
- ('Icon', '_string'),
- ('UnreadMessagesCount', '_primitive'),
- ('TotalMessagesCount', '_primitive'),
- ('Size', '_string'),
- ('IsSystem', '_primitive'),
- ('IsHidden', '_primitive'),
- ('FolderType', '_enum'),
- ('SystemFolderType', '_enum')]
-
-
- class __8(FppClass):
- _fields_ = [
- ('Name', '_string'),
- ('Address', '_string'),
- ('EncodedName', '_string')]
-
-
- class __9(FppClass):
- _fields_ = [
- ('Name', '_string')]
-
-
- class __10(FppClass):
- _fields_ = [
- ('SenderIDResult', '_enum'),
- ('SenderEmail', '__8'),
- ('IsKnownSender', '_primitive'),
- ('ListUnsubscribeEmail', '_string'),
- ('IsSenderInContactList', '_primitive')]
-
-
- class __12(FppClass):
- _fields_ = [
- ('DidSenderIDPass', '_primitive'),
- ('DidSenderIDFail', '_primitive'),
- ('IsBlockAvailableInBL', '_primitive'),
- ('IsSameDomainInBL', '_primitive'),
- ('IsSafeListDomain', '_primitive'),
- ('IsMailingList', '_primitive'),
- ('IsSenderHeaderPresent', '_primitive'),
- ('IsListUnsubscribePresent', '_primitive'),
- ('IsListUnsubscribeInEmailFormat', '_primitive'),
- ('HasReachedMaxFilterLimit', '_primitive'),
- ('IsNeverAllowOrBlockDomain', '_primitive'),
- ('IsBlockSenderException', '_primitive')]
-
-
- class __13(FppClass):
- _fields_ = [
- ('IsFromPRAOnBlockList', '_primitive'),
- ('HasReachedSafeListLimit', '_primitive'),
- ('HasEntriesFromSameDomainInSafeList', '_primitive'),
- ('IsDomainSafe', '_primitive'),
- ('IsSingleToAndNotRecipient', '_primitive'),
- ('HasFilterToJunkToAddress', '_primitive'),
- ('IsRecipientAddressRFCCompliant', '_primitive'),
- ('HasReachedMailingListLimit', '_primitive'),
- ('IsNeverAllowOrBlockDomain', '_primitive'),
- ('IsInContacts', '_primitive')]
-
-
- class __14(FppClass):
- _fields_ = [
- ('Action', '_enum'),
- ('Reason', '_string'),
- ('CalendarEventUrl', '_string'),
- ('Subject', '_string'),
- ('To', '_string'),
- ('Where', '_string'),
- ('When', '_string')]
-
-
- class __16(FppClass):
- _fields_ = [
- ('Header', '__22'),
- ('Body', '_string'),
- ('Attachments', '_array'),
- ('ToLineString', '_string'),
- ('CCLineString', '_string'),
- ('BccLineString', '_string'),
- ('Rfc822References', '_string'),
- ('Rfc822MessageId', '_string'),
- ('Rfc822InReplyTo', '_string'),
- ('DateSentLocal', '_string'),
- ('DateReceivedLocal', '_string'),
- ('SafetyLevel', '_enum'),
- ('MailSenderInfo', '__10'),
- ('MeetingResponseInfo', '__14'),
- ('MeetingIcalId', '_string'),
- ('ReplyFromAddress', '_string'),
- ('HasPhishingLinks', '_primitive'),
- ('IsVerifiedMail', '_primitive'),
- ('AllowUnsafeContentOverride', '_primitive'),
- ('UnsafeContentFiltered', '_primitive'),
- ('UnsafeImagesFiltered', '_primitive'),
- ('DetectedCodePages', '_array'),
- ('CurrentCodePage', '_primitive'),
- ('DraftId', '_string')]
-
-
- class __17(FppClass):
- _fields_ = [
- ('ContentType', '_string'),
- ('Name', '_string'),
- ('Size', '_string'),
- ('BodyIndex', '_primitive'),
- ('AttachmentIndex', '_primitive'),
- ('ForwardId', '_string')]
-
-
- class __18(FppClass):
- _fields_ = [
- ('EOF', '_primitive')]
-
-
- class __19(FppClass):
- _fields_ = [
- ('Prefix', '_string'),
- ('Text', '_string')]
-
-
- class __21(FppClass):
- _fields_ = [
- ('MessageId', '_string'),
- ('IsRead', '_primitive'),
- ('TimeStamp', '_string'),
- ('IsDraft', '_primitive'),
- ('CP', '_primitive'),
- ('AllowUnsafeContent', '_primitive'),
- ('IsVoicemail', '_primitive'),
- ('IsCalllog', '_primitive'),
- ('IsPrivateVoicemail', '_primitive'),
- ('IsMeetingReq', '_primitive')]
-
-
- class __22(FppClass):
- _fields_ = [
- ('AuxData', 'HmAuxData'),
- ('MessageId', '_string'),
- ('OriginalMessageId', '_string'),
- ('FolderId', '_string'),
- ('ExtendedType', '_enum'),
- ('TypeData', '_enum'),
- ('IsRead', '_primitive'),
- ('PopSettingIndex', '_primitive'),
- ('OriginalReplyState', '_enum'),
- ('IsInWhiteList', '_primitive'),
- ('SentState', '_enum'),
- ('MessageSize', '_string'),
- ('HasAttachments', '_primitive'),
- ('From', '__8'),
- ('Subject', '__19'),
- ('DateReceivedUTC', '_date'),
- ('DateReceived', '_date'),
- ('Importance', '_enum'),
- ('IsDraft', '_primitive'),
- ('Marker', '__18'),
- ('MessageSizeString', '_string'),
- ('DateReceivedLocal', '_string'),
- ('TimeStamp', '_string')]
-
-
- class BootstrapSeed(FppClass):
- _fields_ = [
- ('Mode', '_enum'),
- ('FolderId', '_string'),
- ('messageId', '_string'),
- ('count', '_primitive'),
- ('ascendingOrder', '_primitive'),
- ('pageSize', '_primitive'),
- ('totalMessages', '_primitive'),
- ('renderHtml', '_primitive'),
- ('returnHeaders', '_primitive'),
- ('sortBy', '_enum')]
-
-
- class __23(FppClass):
- _fields_ = [
- ('User', '_string'),
- ('UserName', '_string'),
- ('Timestamp', '_string'),
- ('Configuration', '__26'),
- ('Folders', '_array'),
- ('MessageInfo', '__24'),
- ('TodayPage', '_string')]
-
-
- class __24(FppClass):
- _fields_ = [
- ('MessageListHtml', '_string'),
- ('Headers', '_array'),
- ('HeaderTags', '_array'),
- ('MessageHtml', '_string'),
- ('SelectedFolderId', '_string'),
- ('SelectedMessageIndex', '_primitive'),
- ('IsPlainText', '_primitive'),
- ('OverrideCodePage', '_primitive'),
- ('AllowUnsafeContent', '_primitive')]
-
-
- class __25(FppClass):
- _fields_ = [
- ('Signature', '_string'),
- ('FromAddresses', '_array')]
-
-
- class __26(FppClass):
- _fields_ = [
- ('DefaultMsgsInListView', '_primitive'),
- ('KeyboardPressesDelay', '_primitive'),
- ('CachePagesOfMessageHeaders', '_primitive'),
- ('EnableReadingPane', '_primitive'),
- ('HasAcceptedJunkReporting', '_primitive'),
- ('JunkReportingUISeen', '_primitive'),
- ('DefaultContactsInListview', '_primitive'),
- ('SpacesContactBindingEnabled', '_primitive'),
- ('DoSpellCheckAsYouType', '_primitive'),
- ('SpellCheckEnabledInLocale', '_primitive'),
- ('ReadingPaneConfiguration', '_enum'),
- ('AutoSelectMessage', '_primitive'),
- ('MinimumIntervalBetweenSpellChecks', '_primitive'),
- ('UserThemeID', '_primitive'),
- ('SaveSentMessages', '_primitive'),
- ('BalloonTipsEnabled', '_primitive'),
- ('BalloonTipUserPreference', '_primitive'),
- ('IsBigInbox', '_primitive'),
- ('IsAdsDown', '_primitive'),
- ('ForwardingOn', '_primitive')]
-
-
- class __27(FppClass):
- _fields_ = [
- ('ErrorCode', '_string'),
- ('Folders', '_array'),
- ('Headers', '_array')]
-
-
- class FppProxy(object):
-
- def escape(b):
- if b is None:
- return b
-
- a = ''
-
- def slash_escape(m):
- return '\\' + m.group(0)
-
- a = ''.join([
- '"',
- str(b),
- '"'])
- a = re.sub('([\\{|\\}\\[|\\]\\,\\\\:])', slash_escape, a).encode('url')
- return a
-
- escape = staticmethod(escape)
-
- def objToStringImpl(a):
- b = []
- t = type(a)
- if t is unicode:
- a = a.encode('utf-8')
- t = str
-
- if a is None:
- return 'null'
- elif t is str:
- return FppProxy.escape(a)
- elif t is list:
- return FppProxy.arrayToString(a)
- elif t is dict and hasattr(a, 'toString') or getattr(a, '_isFppObject', False):
- return a.toString()
- else:
- return FppProxy.objToString(a)
-
- objToStringImpl = staticmethod(objToStringImpl)
-
- def arrayToString(a):
- res = [
- '[']
- for x in a:
- res.append(FppProxy.objToStringImpl(x))
- res.append(',')
-
- if a:
- res.pop()
-
- res.append(']')
- return ''.join(res)
-
- arrayToString = staticmethod(arrayToString)
-
- def objToString(c):
- if c is None:
- return 'null'
-
- a = [
- '{']
- for name, typ in getattr(c, '_fields_'):
- a.append(FppProxy.objToStringImpl(getattr(c, name)))
- a.append(',')
-
- a[-1] = '}'
- return ''.join(a)
-
- objToString = staticmethod(objToString)
-
- def registerFppMethod(self, name, params, mn, tm, g, ns):
- args = [ x.name for x in params ]
- args.extend(('cb', 'ctx', 'cbError'))
- args_str = ', '.join(args)
- dynamic = [
- 'def %s(%s):\n' % (name, args_str)]
-
- def fppmethod(*args):
- vals = dict(zip((lambda .0: for p in .0:
- p.name)(params), args))
- cb = None
- ctx = None
- cbError = None
- for remaining in args[len(vals):]:
- if cb is None:
- cb = remaining
- continue
-
- if ctx is None:
- ctx = remaining
- continue
-
- if cbError is None:
- cbError = remaining
- continue
- continue
-
- f = self.Network.createFppMethod(ns, mn, cb, cbError)
- for param in params:
- f.addParameter(param.type, vals[param.name])
-
- f.invoke(ctx)
-
- fppmethod.__name__ == name
- setattr(self, name, fppmethod)
-
-
-
- class Network_Type(object):
- configuration = None
-
- def __init__(self, b, opener = None):
- self._isIE = False
- self._isMoz = True
- self._requests = []
- self.configuration = b
- self.opener = opener
-
-
- def set_base_url(self, baseurl):
- self.base_url = baseurl
-
-
- def createFppMethod(self, className, methodName, cb, cbError):
- a = getattr(self, '_fppPrevious', None)
- if a is not None and a._request is not None:
- a._request.abort()
-
- fm = FppMethod(className, methodName, cb, cbError)
- fm.Network = self
- self._fppPrevious = fm
- return fm
-
-
- def createRequest(self, url, callback, verb):
- return HM_Request(url, callback, self, self.opener, verb)
-
-
- def process_response(self, resp, callback):
- data = resp.read()
- log.info('Processing hotmail response: %r', data)
- if resp.code // 100 != 2:
- e = Exception('%r was not successful (code = %r)', resp, resp.code)
- log.info('%r', e)
- return callback.error(e)
-
- match = re.search('new HM\\.FppReturnPackage\\((\\S+?),', data)
- if match is None:
- e = Exception('Response has unknown status code: %r', data)
- log.info('%r', e)
- return callback.error(e)
-
- status = match.group(1)
- log.info('Got status code %r for hotmail request. data was: %r', status, data)
-
- try:
- status = int(status)
- except (ValueError, TypeError):
- e = Exception("Status code could not be int()'d. it was %r (the whole response was %r)", status, data)
- log.info('%r', e)
- return callback.error(e)
-
- if status != 0:
- e = Exception("Got a non-zero status code (%r). Here's the whole response: %r", status, data)
- log.info('%r', e)
- return callback.error(e)
-
- return callback.success(data)
-
- process_response = util.callsback(process_response)
-
-
- class HM_Request(object):
-
- def __init__(self, url, cb, network, opener, verb = None):
- self.url = url
- self.callback = cb
- if not verb:
- pass
- self.verb = 'GET'
- self.postString = None
- self.context = None
- self.headers = { }
- self.opener = opener
- self.network = network
-
-
- def send(self, context):
- self.context = context
- r = asynchttp.HTTPRequest(self.url, self.postString, self.headers, method = self.verb)
- cbargs = dict(success = self.on_response, error = self.on_error)
- if self.opener is None:
- asynchttp.httpopen(r, **cbargs)
- else:
- (None, util.threaded)((lambda : self.opener.open(r)))(**cbargs)
-
-
- def on_response(self, resp = None):
- self.network.process_response(resp, callback = self.callback)
- self.abort()
-
-
- def on_error(self, e = None):
- self.callback.error(e)
- self.abort()
-
-
- def abort(self):
- self.__dict__.clear()
- self.__getattr__ = Null
-
-
-
- class FPPConfig(object):
- RequestHandler = 'mail.fpp'
- FppVersion = '1'
- SessionId = ''
- AuthUser = ''
- CanaryToken = 'mt'
- Version = '1'
- PartnerID = ''
-
- def __init__(self, hotmail):
- self.hotmail = hotmail
-
-
- def CanaryValue(self):
- if self.hotmail is None:
- return None
-
- return self.hotmail.get_cookie(self.CanaryToken, domain = '.mail.live.com')
-
- CanaryValue = property(CanaryValue)
-
-
- class PageInfo(object):
- fppCfg = None
- SELF_PATH = '/mail/InboxLight.aspx'
- queryString = {
- 'nonce': '2122195423' }
-
-
- class FppMethod(object):
- _HTTP_HEADERS = {
- 'X-FPP-Command': '0',
- 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }
-
- def __init__(self, className, methodName, cb, cbError):
- self.className = className
- self.methodName = methodName
- self.callback = cb
- self.callbackError = cbError
- self.context = None
- self._request = None
- self._isInvoked = False
- self._params = []
-
-
- def addParameter(self, a, b):
- self._params.append({
- 'fppType': a,
- 'value': b })
-
-
- def invoke(self, context):
- self.context = context
- if not self.Network.configuration:
- raise Exception('Network is not configured')
-
- if self._isInvoked:
- raise Exception('FppMethod %r already used', self)
-
- self._isInvoked = True
- h = None
- i = None
- l = None
- g = ''
- a = self.Network.configuration
- e = self._params
- f = len(e)
- if f > 0:
- d = []
- j = TypeSystem.escape
- print e
- for c in e:
- d.append(j({
- 'type': c['fppType'],
- 'value': c['value'] }))
- d.append(',')
-
- g = ''.join(d[:-1])
-
- if not a.PartnerID:
- pass
- i = ''.join((util.httpjoin(self.Network.base_url, a.RequestHandler), '?cnmn=', self.className, '.', self.methodName, '&a=', a.SessionId.encode('url'), '&au=', a.AuthUser, '&ptid=', '0'))
- h = ''.join(map(str, ('cn=', self.className, '&mn=', self.methodName, '&d=', g, '&v=', a.FppVersion, '&', a.CanaryToken, '=', a.CanaryValue)))
-
- def clear_request(resp):
- self._request = None
- self._isInvoked = False
-
- self.callback.error.append(clear_request)
- self.callback.success.append(clear_request)
- b.headers = self._HTTP_HEADERS
- b.postString = h
- b.send(self)
- del self.Network
-
-
-
- class HM_Type(FppProxy):
- namespace = 'HM'
- SortBy = FlagsCreate('Sender', 0, 'Subject', 1, 'Size', 2, 'Type', 3, 'Date', 4)
- FppStatus = FlagsCreate('SUCCESS', 0, 'ERR_HTTP_MISCONFIGURATION', -7, 'ERR_HTTP_PARSE_FAILURE', -6, 'ERR_HTTP_CONNECT_FAILURE', -5, 'ERR_HTTP_TIMEOUT', -4, 'ERR_SERVER_UNCAUGHT', -3, 'ERR_APP_SPECIFIC', -2, 'ERR_FPP_PROTOCOL', -1)
- ListNavigateDirection = FlagsCreate('FirstPage', 0, 'LastPage', 1, 'NextPage', 2, 'PreviousPage', 3, 'CurrentPage', 4)
- JmrType = FlagsCreate('Junk', 0, 'NotJunk', 1, 'AV', 2, 'SVMOptInOptOut', 3, 'SVMClassification', 4, 'Phish', 5, 'Unsubscribe', 6, 'Unknown', -1)
- ReadMessageOperation = FlagsCreate('GetMessage', 0, 'NextMessage', 1, 'PreviousMessage', 2, 'MarkAsNotJunk', 3, 'Unsubscribe', 4, 'AddContact', 5, 'None', 6)
- __11 = FlagsCreate('Passed', 0, 'Failed', 1, 'Unknown', 2, 'SoftFail', 3)
- __15 = FlagsCreate('Ok', 0, 'OverQuota', 1, 'DoesntExist', 2, 'Error', 3, 'AccountDoesntExist', 4, 'AccountError', 5)
- __20 = FlagsCreate('Unknown', 0, 'MakeLiveContact', 1, 'AddLiveContact', 2, 'DontShow', 3)
-
- def __init__(self, network):
- self.Network = network
- self._init_methods()
-
-
- def set_base_url(self, hostname):
- self.base_url = 'http://%s/mail/' % hostname
- self.Network.set_base_url(self.base_url)
-
-
- def _init_methods(self):
- self.registerFppMethod('GetInboxData', [
- _primitive('fetchFolderList'),
- _primitive('fetchMessageList'),
- _custom('messageListRenderingInfo'),
- _primitive('fetchMessage'),
- _custom('messageRenderingInfo')], 'GetInboxData', XMLPost, 'abortable', 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox')
- self.registerFppMethod('ClearFolder', [
- _string('clearFolderId'),
- _custom('messageListRenderingInfo')], 'ClearFolder', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox')
- self.registerFppMethod('MoveMessagesToFolder', [
- _string('fromFolderId'),
- _string('toFolderId'),
- _array('messageList'),
- _array('messageAuxData'),
- _custom('messageListRenderingInfo'),
- _custom('messageRenderingInfo')], 'MoveMessagesToFolder', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox')
- self.registerFppMethod('MoveMessagesToFolderNew', [
- _string('fromFolderId'),
- _string('toFolderId'),
- _array('messageList'),
- _array('messageAuxData'),
- _custom('messageListRenderingInfo')], 'MoveMessagesToFolder', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox')
- self.registerFppMethod('MarkMessagesForJmr', [
- _string('folderId'),
- _array('messages'),
- _array('auxData'),
- _enum('jmrType'),
- _primitive('reportToJunk'),
- _custom('messageListRenderingInfo'),
- _custom('messageRenderingInfo')], 'MarkMessagesForJmr', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox')
- self.registerFppMethod('ReportError', [
- _string('message')], 'ReportError', XMLPost, 'abortable', 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox')
- self.registerFppMethod('AddContactFromMessage', [
- _custom('messageRenderingInfo'),
- _string('contactName'),
- _string('contactEmail')], 'AddContactFromMessage', XMLPost, 'abortable', 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox')
- self.registerFppMethod('SvmFeedback', [
- _string('svmUrl'),
- _custom('messageRenderingInfo'),
- _custom('messageListRenderingInfo')], 'SvmFeedback', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox')
- self.registerFppMethod('MarkMessagesReadState', [
- _primitive('readState'),
- _array('messages'),
- _custom('messageListRenderingInfo')], 'MarkMessagesReadState', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox')
- self.registerFppMethod('SendMessage_ec', [
- _string('to'),
- _string('from'),
- _string('cc'),
- _string('bcc'),
- _enum('priority'),
- _string('subject'),
- _string('message'),
- _array('attachments'),
- _string('draftId'),
- _string('draftFolderId'),
- _string('originalMessageId'),
- _string('rfc822MessageId'),
- _string('rfc822References'),
- _string('rfc822InReplyTo'),
- _enum('sentState'),
- _primitive('sendByPlainTextFormat'),
- _array('ignoredWordsFromSpellCheck'),
- _string('hipAnswer'),
- _string('hipMode'),
- _string('meetingIcalId')], 'SendMessage_ec', XMLPost, null, 'Microsoft.Msn.Hotmail.Ui.Fpp.MailBox')
-
-
-
- def doAction(actionName, f):
- a = InboxPage.getSelectedMessageData(true)
- if actionName == 'MarkAsJunk':
- MarkAsJunk(a.mids, a.mads, InboxPage.folderList.fid)
- elif actionName == 'DeleteMessages':
- Messages_remove(a.mids, a.mads)
-
-
-
- def Messages_remove(messageList, messageAuxData):
- Messages_move(messageList, messageAuxData, InboxPage.folderList.fid, App.config.sysFldrs.trashFid)
-
-
- def Messages_move(messageList, messageAuxData, fromFolderId, toFolderId):
- messageListRenderingInfo = InboxPage.createMessageListRenderingInfo(true)
- messageRenderingInfo = None if InboxPage.isReadMessageMode else null
- HM.MoveMessagesToFolder(fromFolderId, toFolderId, messageList, messageAuxData, messageListRenderingInfo, messageRenderingInfo, InboxServices__endUpdateUi)
-
-
- def MarkAsJunk(messageIds, messageAuxData, folderid):
- messageListRenderingInfo = InboxPage.createMessageListRenderingInfo(true)
- messageRenderingInfo = None if InboxPage.isReadMessageMode else null
- HM.MarkMessagesForJmr(messageIds, messageAuxData, folderId, App.config.allowReporting, HM.JmrType.Junk, messageListRenderingInfo, messageRenderingInfo, InboxServices._endSetJunkStatus, {
- 'jmrType': a })
-
-
- def InboxPage_getSelectedMessageData(b):
- if InboxPage.isReadMessageMode:
- d = [
- InboxPage.readingPane.mid]
- e = HM.HmAuxData(Value = a)
- c = [
- e]
- return {
- 'mids': d,
- 'mads': c }
-
- a = InboxPage.messageList.getSelectedMessageData()
- if b and 0 == a.mids.length:
- alert(compatibleDecode(Res.strings.noMessagesSelected))
-
- return a
-
-
- def get_classname(js):
- return re.search('HM\\.registerFppClass\\("(.+?)",', js).group(1)
-
-
- def get_fields(js):
- fields_re = re.compile('Web\\.Network\\.FppProxy\\._(_(?:.+?))\\("(.+?)"\\),')
- return [ x[::-1] for x in fields_re.findall(js) ]
-
-
- def fppclass_to_python(js):
- pformat = pformat
- import pprint
- cname = get_classname(js)
- fields = get_fields(js)
- return 'class %s(FppClass):\n _fields_ = %s\n' % (cname, pformat(fields))
-
-
- def main():
- print str(HmAuxData('10\\|0\\|8CA6DDB632DFE40\\|', null))
-
-
- def main2():
- testapp = testapp
- import tests.testapp
- a = testapp()
- Page = PageInfo()
- Page.fppCfg = FPPConfig(None)
- Network = Network_Type(Page.fppCfg)
- HM = HM_Type(Network)
-
- def doit(callback = (None,)):
- HM.GetInboxData(True, True, None, True, None, Null, None, None)
-
- doit = util.callsback(doit)
-
- def success(resp):
- print 'success', resp
-
-
- def error(e):
- print 'error', e
-
- doit(success = success, error = error)
-
- if __name__ == '__main__':
- main()
-
-